<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<!-- 2.输入月份，显示当月的天数
    要求:1) 利用case穿透简化代码 -->
    <script>
        var month=5;
        var year=2024;
        var str="";
        switch(month)
        {
            case 1:
            case 3:
            case 5:
            case 7:
            case 8:
            case 10:
            case 12:
            str="31天";
            break;
            case 4:
            case 6:
            case 9:
            case 11:
            str="30天"
            break;
            case 2:
            
           if(year%4===0&&year%100!==0||year%400===0)
                {str="29天"}
                else{str="28天"}        
             break;
        }
        console.log(str) 
  

    </script>
</html>